const mongoose = require('mongoose');
const config = require('../config/index')

mongoose.connect(config.devMongodbUrl);//链接一个
const mongoConnectDB = mongoose.connection;

mongoConnectDB.on('error', (err) => {
  console.error(`  MongoDB Connection Error: ${err}`);
});

mongoConnectDB.once('connected', () => {
  console.log(`  MongoDB Connection Success!`);
});

mongoConnectDB.on('disconnected', () => {
  console.error(`  MongoDB Connection Failed!`);
});

module.exports = mongoConnectDB;